package com.jml.exchange.点对点;


import com.jml.utils.MQConnectionUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

/**
 * @author:jml
 * @date: 2020/3/3 13:16
 * @description：
 */
public class Producer {
	
	 static final String QUEUE_NAME = "point-to-point";
	//如果有队列，消息就在队列
	//如果没队列也没消费者，此时消息会丢失。
	 public static void main(String[] args) throws Exception {
		 Connection connection = MQConnectionUtils.newConnection();
		 Channel channel = connection.createChannel();
		 String msg = "点对点发送内容";
		 channel.basicPublish("",QUEUE_NAME,null,msg.getBytes());
		 System.out.println("发送成功");
		 channel.close();
		 connection.close();
	 }
}

